namespace Utils;



public static class SaveFileHelper {

  public static async Task SaveFileAsync(string fileName, string fileDir, Stream stream) {
    if (!Directory.Exists(fileDir)) Directory.CreateDirectory(fileDir);

    string fileFullPath = Path.Combine(fileDir, fileName);
    if (File.Exists(fileFullPath)) return;
    using FileStream fs = new FileStream(fileFullPath, FileMode.Create);
    stream.Position = 0;
    await stream.CopyToAsync(fs);
    stream.Position = 0;
  }

}